﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="PencatatInfoKebakaran.Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Pencatat Info Kebakaran</title>
    <script src="./Scripts/jquery-1.10.2.min.js"></script>
    <script src="./Scripts/jquery.signalR-2.1.2.min.js"></script>
    <script src="./signalr/hubs" type="text/javascript"></script>
    <script type="text/javascript">
        //$(document).ready(function () {
            var hub = $.connection.infoKebakaranHub;

            hub.client.show = function (data) {
                alert(data);
            }

            function sendToServer() {
                $.connection.hub.start().done(function () {
                    hub.server.send();
                });
            }
        //});
    </script>
    <style>
        body {
            font-family: Verdana;
            font-size: 12px;
        }

        .data-empty {
            font-size: 17px;
            padding: 13px;
            text-align: center;
        }

        .control-icon {
            float: left;
        }

        .control-label {
            float: left;
            margin-top: 5px;
            cursor: pointer;
        }

        .form-title {
            font-size: 17px;
            margin-bottom: 13px;
        }

        .form-label {
            float: left;
            margin-top: 2px;
            width: 77px;
        }

        .form-control {
            float: left;
            margin-left: 13px;
        }

        .form-vseparator {
            clear: both;
            margin-bottom: 13px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager_Member" EnablePartialRendering="true" runat="server"></ajaxToolkit:ToolkitScriptManager>
        <asp:UpdatePanel ID="UpdatePanel_Main" runat="server">
            <ContentTemplate>
                <asp:MultiView ID="MultiView_Main" runat="server">
                    <asp:View ID="View_List" runat="server">
                        <div>
                            <div class="control-icon">
                                <asp:ImageButton ID="ImageButton_Action_Add" OnClick="ImageButton_Action_Add_Click" Width="23" ImageUrl="~/Images/Icons/new.png" runat="server" />
                            </div>
                            <div class="control-label">
                                <asp:Label ID="Label_Action_Add" runat="server" AssociatedControlID="ImageButton_Action_Add" Text="tambah"></asp:Label>
                            </div>
                        </div>
                        <asp:GridView ID="GridView_Main" runat="server" Width="100%" AutoGenerateColumns="False" DataKeyNames="KebakaranID"
                            OnSelectedIndexChanged="GridView_Main_SelectedIndexChanged"
                            OnRowCommand="GridView_Main_RowCommand">
                            <EmptyDataTemplate>
                                <div class="data-empty">
                                    Tidak ada data laporan kebakaran.
                                </div>
                            </EmptyDataTemplate>
                            <Columns>
                                <asp:TemplateField HeaderStyle-Width="1%">
                                    <HeaderTemplate>&nbsp;</HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:ImageButton ID="ImageButton_GridView_Main_Action_Delete" CommandName="Erase" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "KebakaranID") %>' ToolTip="Ubah status" ImageUrl="~/Images/Icons/delete.png" Width="32" runat="server" />
                                        <ajaxToolkit:ConfirmButtonExtender ID="cbe" runat="server" TargetControlID="ImageButton_GridView_Main_Action_Delete" ConfirmText="Apakah kebakaran telah dipadamkan?" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:ButtonField ButtonType="Link" CommandName="Select" DataTextField="WaktuInput" DataTextFormatString="{0:dd-MMM-yyyy HH:mm}" HeaderText="Waktu Input" SortExpression="WaktuInput" />
                                <asp:BoundField DataField="LokasiKebakaran" HeaderText="Lokasi Kebakaran" SortExpression="LokasiKebakaran" />
                                <asp:BoundField DataField="Longitude" HeaderText="Longitude" SortExpression="Longitude" />
                                <asp:BoundField DataField="Latitude" HeaderText="Latitude" SortExpression="Latitude" />
                                <asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
                            </Columns>
                        </asp:GridView>
                    </asp:View>
                    <asp:View ID="View_Form" runat="server">
                        <asp:ValidationSummary ID="ValidationSummary_Main" ShowMessageBox="true" ShowSummary="false" ValidationGroup="Main" runat="server" />
                        <div class="form-title">Form Input Kebakaran</div>
                        <div class="form-label">Lokasi</div>
                        <div class="form-control">
                            <asp:TextBox ID="TextBox_Lokasi" TextMode="MultiLine" Width="300px" Rows="4" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator_Lokasi" ControlToValidate="TextBox_Lokasi" ValidationGroup="Main" runat="server" ErrorMessage="Lokasi harus diisi." ToolTip="Lokasi harus diisi.">*</asp:RequiredFieldValidator>
                        </div>
                        <div class="form-vseparator"></div>
                        <div class="form-label">Longitude</div>
                        <div class="form-control">
                            <asp:TextBox ID="TextBox_Longitude" runat="server"></asp:TextBox>
                            <%--<asp:CompareValidator ID="CompareValidator_Longitute" runat="server" ErrorMessage="Nilai harus angka." ToolTip="Nilai harus angka." ControlToValidate="TextBox_Longitude" Type="Double" ValidationGroup="Main">*</asp:CompareValidator>--%>
                        </div>
                        <div class="form-vseparator"></div>
                        <div class="form-label">Latitude</div>
                        <div class="form-control">
                            <asp:TextBox ID="TextBox_Latitude" runat="server"></asp:TextBox>
                            <%--<asp:CompareValidator ID="CompareValidator_Latitude" runat="server" ErrorMessage="Nilai harus angka." ToolTip="Nilai harus angka." ControlToValidate="TextBox_Latitude" Type="Double" ValidationGroup="Main">*</asp:CompareValidator>--%>
                        </div>
                        <div class="form-vseparator"></div>

                        <div class="control-icon" style="margin-left: -7px">
                            <asp:ImageButton ID="ImageButton_Action_Save" OnClick="ImageButton_Action_Save_Click" ValidationGroup="Main" Width="32" ImageUrl="~/Images/Icons/save.png" runat="server" />
                        </div>
                        <div class="control-label" style="margin-top: 7px">
                            <asp:Label runat="server" AssociatedControlID="ImageButton_Action_Save" Text="simpan"></asp:Label>
                        </div>

                        <div class="control-icon" style="margin-left: 13px;">
                            <asp:ImageButton ID="ImageButton_Action_Cancel" OnClick="ImageButton_Action_Cancel_Click" Width="32" ImageUrl="~/Images/Icons/cancel.png" runat="server" />
                        </div>
                        <div class="control-label" style="margin-top: 7px">
                            <asp:Label runat="server" AssociatedControlID="ImageButton_Action_Cancel" Text="batal"></asp:Label>
                        </div>
                    </asp:View>
                </asp:MultiView>
            </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>
